<jsp:include page="header.jsp"></jsp:include>
	<table>
		<thead>
			<tr>
				<th>Item name</th>
				<th>Stock</th>
				<th>Price</th>
				<th>Amount</th>
				<th></th>
			</tr>
		</thead>
		<tbody>
				<%@ page import="net.affenkakka.shop.CloudManager" %>
				<%@ page import="java.util.*" %>
				<%@ page import="org.jdom.Element,org.jdom.Namespace" %>
				<%
					Namespace ns = Namespace.getNamespace("http://www.cs.au.dk/dWebTek/2011");
					List<Element> items = CloudManager.getItems();
					int i = 0;
					for (Element item : items)
					{
						if (i % 2 == 0)
						{
							out.println("<tr class=\"background-light-grey\">");
						} else {
							out.println("<tr>");
						}

						out.println("<form action=\"AddToBasket\" method=\"POST\">");
						
						out.println("<td>" + item.getChildText("itemName", ns) + "</td>");
						out.println("<td>" + item.getChildText("itemStock", ns) + "</td>");
						out.println("<td>$" + item.getChildText("itemPrice", ns) + "</td>");
						
						out.println("<td>");
						out.println("<input type=\"hidden\" name=\"itemID\" value="+ item.getChildText("itemID", ns) +" />");
						out.println("<input type=\"text\" name=\"amount\" />");
						out.println("</td>");
						
						out.println("<td>");
						out.println("<input type=\"submit\" value=\"Buy\" />");
						out.println("</form>");
						out.println("</td>");
						
						out.println("</tr>");
					}
				%>
		</tbody>
	</table>
<jsp:include page="footer.jsp"></jsp:include>